package Reflection;

import java.lang.reflect.Method;
import java.util.Arrays;

public class demo11 {
    public static void main(String[] args) throws Exception {

        //先获取class对象
        Class c = Cat.class;
        //再获取指定方法
        Method setNameMethod = c.getDeclaredMethod("setName", String.class);
        System.out.println(setNameMethod.getName() + " => " + Arrays.toString(setNameMethod.getParameterTypes()) + " => " + setNameMethod.getReturnType());

    }
}
